package work.jame.blog.mapper;

import org.apache.ibatis.annotations.Param;
import work.jame.blog.pojo.Comment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import work.jame.blog.pojo.vo.RootCommentVO;
import work.jame.blog.pojo.vo.SonCommentVO;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Jame
 * @since 2023-05-18
 */
public interface CommentMapper extends BaseMapper<Comment> {

    /**
     * 查询评论发送者id根据评论id
     * @param commentId 评论id
     * @return 评论发送者id
     */
    Long queryCommentSendUserIdByCommentId(@Param("commentId")Long commentId);


    /**
     * 查询文章根级评论
     * @param articleId 文章id
     * @param startLine 起始行
     * @param currentUserId 当前登录用户的id
     * @param pageSize 页大小
     * @param orderType 排序规则 true 根据热度  false根据时间
     * @return RootCommentVO
     */
    List<RootCommentVO> queryRootCommentByArticleId(@Param("articleId")Long articleId,
                                                    @Param("currentUserId")Long currentUserId,
                                                    @Param("startLine")Long startLine,
                                                    @Param("pageSize")Long pageSize,
                                                    @Param("orderType")Boolean orderType);

    /**
     * 查询文章子级评论
     * @param parentCommentId 父级评论id
     * @param currentUserId 当前登录用户的id
     * @param startLine 起始行
     * @param pageSize 页大小
     * @return SonCommentVO
     */
    List<SonCommentVO> querySonCommentByArticleId(@Param("parentCommentId")Long parentCommentId,
                                                  @Param("currentUserId")Long currentUserId,
                                                  @Param("startLine")Long startLine,
                                                  @Param("pageSize")Long pageSize);



}
